const fs = require('fs');
const path = require('path');

// 读取当前配置
const configPath = path.join(__dirname, 'src/config/ocr-config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));

// 切换到PP-OCR
config.serviceType = 'ppocr';

// 清空其他服务的配置
config.baiduApiKey = '';
config.baiduSecretKey = '';
config.accessKeyId = '';
config.accessKeySecret = '';
config.endpoint = '';
config.region = '';

// 保存配置
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));

console.log('✅ OCR配置已切换到PP-OCR');
console.log('📝 配置内容:');
console.log(JSON.stringify(config, null, 2));
console.log('\n🚀 请确保PP-OCR服务已启动在: http://localhost:8866');
console.log('💡 如需修改端点，请设置环境变量: PPOCR_ENDPOINT=http://your-ppocr-service:port/predict/ocr_system');